package com.example.smartcity_poverty.ui.AllService.OA.adapter

import android.content.Intent
import com.example.smartcity_poverty.Base.BaseRecyclerAdapter
import com.example.smartcity_poverty.logic.util.Util.show
import com.example.smartcity_poverty.ui.AllService.OA.activity.OaShowMeDataActivity
import com.example.smartcity_poverty.ui.AllService.OA.model.OaShowMeEntity
import kotlinx.android.synthetic.main.re_oa_show_me.*

/**
 *  created by ikun
 *  ANDROID STUDIO - version 4.0
 *  email: jinkunwei41@gmail.com
 * --------------------------------
 *  天机就诊人信息适配器
 **/
class OaAddMeAdapter (
    val list: MutableList<OaShowMeEntity>,
    layoutId: Int
) : BaseRecyclerAdapter<OaShowMeEntity>(list, layoutId){
    override fun setData(
        view: BaseViewHolder.ViewFind,
        data: OaShowMeEntity,
        position: Int,
        holder: BaseViewHolder
    ) {
        // 填充数据
        val d = list[position]
        val fv = holder.viewFind
        val con = holder.viewFind.view?.context

        fv.oaShowMeName.text = d.name
        fv.oaShowMeSex.text = "性别: ${d.sex}"
        fv.oaShowMePhone.text = "联系电话: ${d.phone}"

        holder.itemView.setOnClickListener {
            con?.startActivity(Intent(con, OaShowMeDataActivity::class.java).apply {
                putExtra("name", d.name)
                putExtra("sex", d.sex)
                putExtra("phone", d.phone)
            })
        }
    }
}